<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no">
    <script src="../vue.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        .fontSize {
            width: 100px;
            height: 100px;
            background-color: green;
            line-height: 100px;
            font-size: 5px;
        }

        .color {
            color: red;
        }

    </style>
</head>
<body>

<div class="content_body">
    <button @click="handle">{{ text }}</button>
    <div class="fontSize color" v-if="show">{{ name }}</div>
</div>
<script>
    let app = new Vue({
        el: '.content_body',
        data() {
            return {
                text: '显示',
                name: '你到底爱不爱我？',
                show: false,
            }
        },
        methods: {
            handle() {
                this.show = !this.show;

                this.text = this.show ? '隐藏' : '显示'

                // if (this.text === this.show) {
                //     this.text='显示'
                // }else{
                //     this.text='隐藏'
                // }

            }
        }
    })
</script>
</body>
</html>